#include <iostream>

using namespace std;

const int N = 1e6 + 10;

string s;
int n;
int pi[N];

int kmp()
{
	n = s.size();
	s = ' ' + s;
	
	for(int i = 2; i <= n; i++)
	{
		int j = pi[i - 1];
		while(j && s[i] != s[j + 1]) j = pi[j];
		if(s[i] == s[j + 1]) j++;
		pi[i] = j;
	}
	
	if(n % (n - pi[n])) return 1;
	else return n / (n - pi[n]);
}

int main()
{
	while(cin >> s)
	{
		if(s == ".") break;
		
		cout << kmp() << endl;
	}
	
	return 0;
}










